package com.xohm.platform.api;

/**
 * Xohm Connection Manager
 *
 * Licensed Material - Property of Sprint Nextel
 * Restricted Materials of Sprint Nextel
 * (C) Copyright Sprint Nextel Corp. 2008 - All Rights Reserved.
 *
 * <Class Description>
 *
 * @author Robin Katzer
 */
abstract class OSAPIBase
{
	private String osName      = null;

	protected OSAPIBase()
	{
	}
	
	/**
	 * Returns the OS name of the platform this program is
	 * running on to the receiver.
	 * 
	 * @return java.lang.String
	 */
	private String getOSName()
	{
		if (osName == null)
			osName = System.getProperty("os.name");
		
		return osName;
	}
	
	/**
	 * Is the current platform windows?
	 * 
	 * @return boolean
	 */
	public boolean isWindows()
	{
		boolean isWindows = false;
		if (getOSName().toLowerCase().indexOf("windows") > -1)
			isWindows = true;
		
		return isWindows;
	}
	
	/**
	 * Is the current platform macintosh?
	 * 
	 * @return boolean
	 */
	public boolean isMac()
	{
		boolean isMac = false;
		if (getOSName().toLowerCase().indexOf("mac os x") > -1)
			isMac = true;
		
		return isMac;
	}
	
	/**
	 * Is the current platform linux?
	 * 
	 * @return boolean
	 */
	public boolean isLinux()
	{
		boolean isLinux = false;
		if (getOSName().toLowerCase().indexOf("linux") > -1)
			isLinux = true;
		
		return isLinux;
	}
}
